/**
 */
package org.mro.grib.model.files.secondEdition.products.impl;

import java.nio.ByteBuffer;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.mro.grib.model.files.secondEdition.products.ProductDefinitionTemplate4254;
import org.mro.grib.model.files.secondEdition.products.ProductsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Product Definition Template4254</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate4254Impl#getParameterCategory <em>Parameter Category</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate4254Impl#getParameterNumber <em>Parameter Number</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate4254Impl#getNumberOfCharacters <em>Number Of Characters</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ProductDefinitionTemplate4254Impl extends EObjectImpl implements ProductDefinitionTemplate4254 {
	/**
	 * The default value of the '{@link #getParameterCategory() <em>Parameter Category</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getParameterCategory()
	 * @generated
	 * @ordered
	 */
	protected static final byte PARAMETER_CATEGORY_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getParameterCategory() <em>Parameter Category</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getParameterCategory()
	 * @generated
	 * @ordered
	 */
	protected byte parameterCategory = PARAMETER_CATEGORY_EDEFAULT;

	/**
	 * The default value of the '{@link #getParameterNumber() <em>Parameter Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getParameterNumber()
	 * @generated
	 * @ordered
	 */
	protected static final byte PARAMETER_NUMBER_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getParameterNumber() <em>Parameter Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getParameterNumber()
	 * @generated
	 * @ordered
	 */
	protected byte parameterNumber = PARAMETER_NUMBER_EDEFAULT;

	/**
	 * The default value of the '{@link #getNumberOfCharacters() <em>Number Of Characters</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberOfCharacters()
	 * @generated
	 * @ordered
	 */
	protected static final int NUMBER_OF_CHARACTERS_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNumberOfCharacters() <em>Number Of Characters</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberOfCharacters()
	 * @generated
	 * @ordered
	 */
	protected int numberOfCharacters = NUMBER_OF_CHARACTERS_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProductDefinitionTemplate4254Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductsPackage.Literals.PRODUCT_DEFINITION_TEMPLATE4254;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getParameterCategory() {
		return parameterCategory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParameterCategory(byte newParameterCategory) {
		byte oldParameterCategory = parameterCategory;
		parameterCategory = newParameterCategory;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_CATEGORY, oldParameterCategory, parameterCategory));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getParameterNumber() {
		return parameterNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParameterNumber(byte newParameterNumber) {
		byte oldParameterNumber = parameterNumber;
		parameterNumber = newParameterNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_NUMBER, oldParameterNumber, parameterNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNumberOfCharacters() {
		return numberOfCharacters;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberOfCharacters(int newNumberOfCharacters) {
		int oldNumberOfCharacters = numberOfCharacters;
		numberOfCharacters = newNumberOfCharacters;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__NUMBER_OF_CHARACTERS, oldNumberOfCharacters, numberOfCharacters));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_CATEGORY:
				return getParameterCategory();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_NUMBER:
				return getParameterNumber();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__NUMBER_OF_CHARACTERS:
				return getNumberOfCharacters();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_CATEGORY:
				setParameterCategory((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_NUMBER:
				setParameterNumber((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__NUMBER_OF_CHARACTERS:
				setNumberOfCharacters((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_CATEGORY:
				setParameterCategory(PARAMETER_CATEGORY_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_NUMBER:
				setParameterNumber(PARAMETER_NUMBER_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__NUMBER_OF_CHARACTERS:
				setNumberOfCharacters(NUMBER_OF_CHARACTERS_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_CATEGORY:
				return parameterCategory != PARAMETER_CATEGORY_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__PARAMETER_NUMBER:
				return parameterNumber != PARAMETER_NUMBER_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE4254__NUMBER_OF_CHARACTERS:
				return numberOfCharacters != NUMBER_OF_CHARACTERS_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (parameterCategory: "); //$NON-NLS-1$
		result.append(parameterCategory);
		result.append(", parameterNumber: "); //$NON-NLS-1$
		result.append(parameterNumber);
		result.append(", numberOfCharacters: "); //$NON-NLS-1$
		result.append(numberOfCharacters);
		result.append(')');
		return result.toString();
	}

	/* (non-Javadoc)
	 * @see org.mro.grib.model.files.secondEdition.products.IProductDefinition#initialise(java.nio.ByteBuffer)
	 */
	@Override
	public void initialise(ByteBuffer buffer) {
		parameterCategory = buffer.get();
		parameterNumber = buffer.get();
		numberOfCharacters = buffer.getInt();
	}

} //ProductDefinitionTemplate4254Impl
